package com.example.zytj.handler;

import java.util.Date;

import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;

import org.apache.commons.lang.time.DateUtils;
import org.apache.ibatis.reflection.MetaObject;
import org.springframework.stereotype.Component;

@Component
public class MyMetaObjectHandler implements MetaObjectHandler{
    @Override
	public void insertFill(MetaObject metaObject) {
		this.setFieldValByName("inTime", new Date(), metaObject);
		this.setFieldValByName("outTime", DateUtils.addMinutes(new Date(), 10), metaObject);
		System.out.println("打印时间："+new Date());
	}

	@Override
	public void updateFill(MetaObject metaObject) {
		this.setFieldValByName("outTime", DateUtils.addMinutes(new Date(), 10), metaObject);
	}
}
